package com.menggudf.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.menggudf.model.ResultModel;
import com.menggudf.service.SysCaseHistoryService;

@Controller
@RequestMapping("/sysCaseHistory")
public class SysCaseHistoryController {
    
    @Autowired
    SysCaseHistoryService sysCaseHistoryService;
    
    @RequestMapping("/getList")
    @ResponseBody
    public Map<String, Object> getList(
            @RequestParam(value="userName",required=false) String userName,
            @RequestParam("limit") int pageSize,
            @RequestParam("offset") int offset){
        return sysCaseHistoryService.getList(userName,pageSize,offset);
    }
    
    @RequestMapping("/editSysCaseHistoryActive")
    @ResponseBody
    public ResultModel editSysCaseHistoryActive(
            @RequestParam("active") String active,
            @RequestParam("id") int id){
        return sysCaseHistoryService.editSysCaseHistoryActive(id,active);
    }
    
    /**
     * 把诊断结果保存成病历
     * @param request
     * @param response
     * @param sysptom
     * @param scheme
     * @param inquiryResult
     * @param medicine
     * @return
     */
    @RequestMapping("/toSaveSysHistory")
    @ResponseBody
    public  ResultModel  toSaveSysHistory(
            @RequestParam(value="symptoms",required=false) String sysptoms,//病症
            @RequestParam(value="scheme",required=false) String scheme,//诊疗方案
            @RequestParam(value="illness",required=false) String illness,
            @RequestParam(value="medicine",required=false) String medicine,
            @RequestParam("role") Integer role,//角色
            @RequestParam("userCode") String userCode//唯一id
            ){
        return sysCaseHistoryService.toSaveSysHistory(sysptoms,scheme,illness,medicine,role,userCode);

    }
    
}
